package com.inf.featureCompare;


import com.sun.jersey.core.util.Base64;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangbn on 2018/09/28.
 */
public class FeatureCompare {

    static {
        System.load("/opt/tools/work/cdir/libst_feature_comp.so.1");
        System.load("/opt/tools/work/cdir/libcom_inf_px_jni_test_STFeature.so");
    }

    public native double[] featureCompByByte(byte[] var1, List var2);


    /**
     * 测试调用SO库函数（只能在linux环境运行）
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {

        final String feaTure1 = "7qpXQideAAAAAQAAMmHpOi1BbjpY6YM9NtXDPIFAobwM3c88amnCPRxbNT35GYW69uwYPeth5Dy4TxS8TQNVPAiQFr1Wr0W95PSTPSeDd72kHaS8ozbGvNy0OL1Zcv09D7zCPekPtb13osQ8CaYwvTEFGj1DRHw9w6wCvqXPG70s5Ay9bT8lPdy1k71rIgk9zBGIPY8RwbuXqoA9SXf6vCkbtr0LZMA9z6MRPRHfP7oxRDY+rZ9Mvfzh6bou1f27n8JhvJKdrL1iSDo9nHA0Pas/1j3fezg9movEPNJXQTviTo48lWilvIddwT35FJQ9CKPfu++mKr1CxV29iKOePea1/7ouhhG9pw6hPA/0Bz2TxtM7JMK8vKrRBj7vrDA9FWcdvA9Ssr0uxIE92cOmuo4L4T03+n89V/iOPdiyJzyg8Ba9Np8OvEIqjbwxLzg9sDKUPZUq2Dwe3BW9OilMvKXBBr0eLT29kT1lPEklHT0pUz++qpgEvpqpRrxlSMk8NhGNvKybpLwbl1I+CwC9PaIVr72enFW8rWB4vDqYaj2JQfC9O3IVvXz9OTz13KM9QLRIPUogobv0v5i9/sDEPWChbr20MqK9ChKCOqtd+buPTJe8fEMTPT4Dkz01AxW+Tv6WvXdSST35hlw9kdwCvdjNgDptKlO9v1iJvKw4eTyMAji94N8xu0bSy7yoxqW9MtrLPdAjvr3yna67RoAaOoCVqr2v+Fq9fb2Qve2dAD3n96i9qKwKvY4+cD1/Bi08UacsPePnsrwYflY9dMZVPeKNkr1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O9t8HNvZ7BNb3lCA8+46juO+G46rykAyM9vMeAPBwqvrwb2xU9ToEivFYB/jxvNSa9kDDzuwLFgzsGX568yhM3PfpfF73a/9A7MyAoPTCMwj0WJ5C9Dkg7vOXH0j2+ir86rAjCvKR+Ur0UylK9krxmvMdKFT5hA+K7ocMSvB7zUD01ABq85KhxvD44hz308QA9bxPRPPGmm711qhM8nfW2PdEBkb0+daY9wtMsPRJfAz17cc280dUAvChC4b2p02w9shnQPYWFOj2E13E8+sNBvfXZab1lyr86Zb3rvXUAPb3788y9tTC4Pd2cP70P52U932krPYeNpT3qZZ08TCBFPDr1Hjw0Lja9iTCQvKoB/LxzX1g9OiRivcEJzz2+tiU8jtksPnU/DjwPgDy9kmE2PCFIcz2oaYA9U7SuPXUJh7xEvto9KItvvUn+/jwwK7G9tTkKPq31nbwtXNS9cr8bPeQ0zLtjLNq6s8qavUDgiDzcdqy904aivSUQaT00vIi8Sr5bPfevFr0TS/G84JyhPZANwzyJWOQ90TjbvSKlaD13Llm9daIUvXO3Yb3PIpi8BugIPgckW72fCLc9oqTQvaIKMTu+cIQ9ucHOvAT2tzxHKvk8W0BIPZogQjzP66K9zwTQvO5pvLvF+Wo9AEMOvdbJ9T20D5S8lkbOvStlrT3bfDU9NF3DOzJoRD1V4yM8PP3ZPZuHlz026cM9QSrIvaabgb0eOZW92GMUvmyuizvOmTK99E+TvPe8Uj3LsuI7BleZPLVBM73KVF89LCxGPV6wLD1qPLs9dI/+PZmpLbvRTXW74tKOPS/exDxavv48+lE7PEahmr1/GdM8yer9O2S72b1i8+g8s54gvAJ9Bb3D0eg8HapLvQ==";

        List list = new ArrayList();
        byte[] var1 = Base64.decode(feaTure1);
        byte[] var2 = Base64.decode(feaTure2);

        long beginLong = System.currentTimeMillis();

        for (int t = 0; t < 20; t++) {
            list.add(var2);
        }
        double[] doubleArrays = new FeatureCompare().featureCompByByte(var1, list);
        for (int i = 0; i < doubleArrays.length; i++) {
            double floatsim = doubleArrays[i];
            System.out.println(floatsim);
        }

        long endLong = System.currentTimeMillis();
        System.out.println(list.size() + "所消耗的时间:\t " + (endLong - beginLong));
    }
}